<?php
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/

//相册

Route::get('/albums', 'albumsController@index')->name('home');

Route::get('/home', 'albumsController@index');

//相册资源路由
Route::resource('albums','AlbumsController');

//相片资源路由
Route::resource('photos','PhotosController');

Route::post('photos/store','PhotosController@store');


//博客
Route::get('/blog', 'ArticlesController@index')->name('blog');
Route::resource('blog','ArticlesController');

//markdown 文章显示
Route::resource('mkshow/{id}','ArticlesController@MKshow');
//ajax阅览markdown
Route::post('markdown','ArticlesController@markdown')->name('markdown');

//ajax上传文件

Route::get('avater', 'ArticlesController@avater');
Route::post('photo','ArticlesController@photo');

Route::get('error',function(){
	return view('errors.503');
});


//路由演示
Route::get('/lamp',function(){
	echo 'lamp';
});



Route::match(['get','post'],'/topic',function(){
	echo 'something';
});

//参数
Route::get('/user/{id}', function ($id) {
	return 'User '.$id;
});

//可选参数
Route::get('/name/{name}/user/{id?}', function ($name,$id='0') {
	return 'User '.$id.'Name'.$name;
});
//参数限制
Route::get('/user/{id}', function ($id) {
	return 'User '.$id;
})->where('id','[0-9]+');
//NotFoundHttpException in RouteCollection.php line 161:
//
//
Route::get('/test', 'Home\TestController@index');



//资源控制器
Route::resource('/blog2', 'Home\TestController');



//隐式路由
Route::controller('/aaa', 'Home\TestController');

Route::controller('/db', 'Home\DbController');

Route::controller('/mvc', 'Home\MVCController');




Route::resource('/b', 'Home\BlogController');
Route::post('/b/pre_mk','Home\BlogController@pre_mk');


//登录注册

// 认证路由...
Route::get('auth/login', 'Auth\AuthController@getLogin');
Route::post('auth/login', 'Auth\AuthController@postLogin');
Route::get('auth/logout', 'Auth\AuthController@getLogout');
// 注册路由...
Route::get('auth/register', 'Auth\AuthController@getRegister');
Route::post('auth/register', 'Auth\AuthController@postRegister');


/*Route::get('/admin/index', function(){
	return view('admin.index');
});

Route::get('/admin/welcome', function(){
	return view('admin.welcome');
});

Route::get('/admin/user', function(){
	return view('admin.userlist');
});

Route::group(['prefix'=>'admin'],function(){
	Route::get('index', function(){
		return view('admin.index');
	});

	Route::get('welcome', function(){
		return view('admin.welcome');
	});

	Route::resource('cate', 'Admin\CateController');
	Route::get('catelist', 'Admin\CateController@list');

	Route::resource('user', 'Admin\UserController');
});
*/
//购物车

Route::resource('shop', 'Home\ShopController');
Route::controller('shop', 'Home\ShopController');
Route::get('/addcart/{id}', 'Home\ShopController@addcart');
Route::get('/cart', 'Home\ShopController@cart')->name('cart');
Route::get('/del', 'Home\ShopController@destroy');

